﻿using System.Threading.Tasks;
using Poem.Core.Entities;
using Volo.Abp.Domain.Repositories;
using Xunit;

namespace Poem.EF.Test
{
    public class TestRepostitory : PoemEFTestBase
    {
        private IRepository<Category> _cateoryRepository;

        public TestRepostitory()
        {
            _cateoryRepository = GetRequiredService<IRepository<Category>>();
        }

        [Fact]
        public async Task TestAddCategory()
        {
            await WithUnitOfWorkAsync(async () =>
            {
                var category = await _cateoryRepository.InsertAsync(new Category { CategoryName = "测试" }, true);
                Assert.True(category.Id > 0);
            });
        }
    }
}
